#include<iostream>
#include<string>
#include<string.h>
#include<cstdio>
using namespace std;
typedef long long LL;
const int N = 1e6 + 10;
char s[N];
int ne[N];
LL ans;
int main()
{
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	//cout << len << endl;
	ans += len;
	for (int i = 2, j = 0; i <= len; i++) {
		while (j && s[i] != s[j + 1])j = ne[j];
		if (s[i] == s[j + 1])j++;
		ne[i] = j;
		//ans += ne[i];
		if (ne[i])ans++;
		int k = i - ne[i];
		cout << "k==" << k << endl;
		if (ne[k])ans++;
		cout << "ne[i]==" << ne[i] << endl;
	}
	cout << ans << endl;
	return 0;
}